<!doctype html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head(~{::title})">
    <title>shell845 | home</title>
</head>

<body>
<!-- Nav bar-->
<nav th:replace="_fragments :: menu(1)" ></nav>

<!-- Content -->
<div class="m-container m-padded-tb-mid">
    <div class="ui container">
        <div class="ui stackable grid">
            <!--Left content-->
            <div class="twelve wide column">
                <!--content header-->
                <div class="ui top attached segment">
                    <div class="ui middle aligned two column grid">
                        <div class="column">
                            <h3 class="ui header"><span style="color: #6BB6A1">Blog</span></h3>
                        </div>
                        <div class="right aligned column">
                            <h2 class="ui header m-inline-block m-text-thin" th:text="${page.totalElements}"> # </h2>
                            <span class="m-poolside">posts</span>
                        </div>
                    </div>
                </div>
                <!--content list-->
                <div class="ui attached segment">
                    <!--content-->
                    <div class="ui padded vertical segment m-padded-tb-mid" th:each="blog: ${page.content}">
                        <div class="ui mobile reversed stackable grid">
                            <div class="eleven wide column">
                                <h3 class="ui header"><a href="#" th:href="@{/blog/{id}(id=${blog.id})}" th:text="${blog.title}">Test1</a></h3>
                                <p class="m-text" th:text="|${blog.description}...|">Testing here</p>
                                <div class="ui stackable grid">
                                    <div class="eleven wide column">
                                        <div class="ui mini horizontal link list">
                                            <div class="item">
                                                <img src="https://picsum.photos/id/102/100/100" th:src="${blog.user.avatar}==null? @{/images/smalllogo.png} : @{${blog.user.avatar}}" alt="" class="ui avatar image">
                                                <div class="content"><a href="#" class="header" th:text="${blog.user.nickname}">shell845</a></div>
                                            </div>
                                            <div class="item">
                                                <i class="calendar icon"></i> <span th:text="${#dates.format(blog.updateTime,'MM-dd-yyyy')}">04-09-2020</span>
                                            </div>
                                            <div class="item">
                                                <i class="eye icon"></i> <span th:text="${blog.views}">2834</span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="right aligned five wide column">
                                        <a href="#" class="ui basic label m-text-thin m-padded-mini"><span style="color: #6BB6A1" th:text="${blog.type.name}">a tag</span></a>
                                    </div>
                                </div>
                            </div>

                            <div class="five wide column">
                                <a href="#" th:href="@{/blog/{id}(id=${blog.id})}">
                                    <img src="https://picsum.photos/id/102/600/400" th:src="${blog.headerPicture}==null? @{${blog.headerPicture}} : @{/images/smalllogo.png}" alt="" class="ui rounded image">
                                </a>
                            </div>
                        </div>
                    </div>
                </div>

                <!--content bottom-->
                <div class="ui bottom attached segment" th:if="${page.totalPages} > 1">
                    <div class="ui middle aligned two column grid">
                        <div class="column">
                            <a href="#" th:href="@{/(page=${page.number}-1)}" th:unless="${page.first}" class="ui mini teal basic button">Prev</a>
                        </div>
                        <div class="right aligned column">
                            <a href="#" th:href="@{/(page=${page.number}+1)}"th:unless="${page.last}" class="ui mini teal basic button">Next</a>
                        </div>
                    </div>
                </div>
            </div>
            <!--Right content-->
            <div class="four wide column">
                <!-- category -->
                <div class="ui segments">
                    <div class="ui secondary segment" >
                        <div class="ui two column grid">
                            <div class="column"><i class="fas fa-book"></i> Categories
                            </div>
                            <div class="right aligned column"><a href="#" th:href="@{/types/-1}"><i class="angle double right icon"></i></a>
                            </div>
                        </div>
                    </div>
                    <div class="ui segment">
                        <div class="ui fluid vertical menu">
                            <a href="#" th:href="@{/types/{id}(id=${type.id})}" class="item" th:each="type : ${types}">
                                <span class="m-poolside" th:text="${type.name}">Study</span>
                                <div class="ui teal basic left pointing label m-text-thin" th:text="*{type.blogs}!=null ? ${#arrays.length(type.blogs)}">13</div>
                            </a>
                        </div>
                    </div>
                </div>
                <!-- tags -->
                <div class="ui segments">
                    <div class="ui secondary segment">
                        <div class="ui two column grid">
                            <div class="column"><i class="fas fa-tag"></i> Tags
                            </div>
                            <div class="right aligned column"><a href="#" th:href="@{/tags/-1}"><i class="angle double right icon"></i></a>
                            </div>
                        </div>
                    </div>
                    <div class="ui segment">
                        <a href="#" th:href="@{/tags/{id}(id=${tag.id})}"  class="ui teal basic left pointing label m-margin-tb-mini" th:each="tag : ${tags}">
                            <span th:text="${tag.tagName}">tagName</span>
                            <div class="detail" th:text="*{tag.blogs}!=null ? ${#arrays.length(tag.blogs)}">9</div>
                        </a>
                    </div>
                </div>
                <!-- latest -->
                <div class="ui segments">
                    <div class="ui secondary segment">
                        <i class="fab fa-hotjar"></i> Latest</div>
                        <div class="ui segment" th:each="blog : ${recommendBlogs}">
                            <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" class="m-poolside" th:text="${blog.title}"> Story 1 </a>
                        </div>
                </div>
            </div>
        </div>

    </div>
</div>

<!-- Footer -->
<footer th:replace="_fragments :: footer"></footer>

<!-- JavaScript -->
<th:block th:replace="_fragments :: script"></th:block>

</body>
</html>